import com.travel.entity.TArticle;
import com.travel.entity.TArticleComments;
import com.travel.service.TArticleCommentsService;
import com.travel.service.TArticleService;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations ="classpath:applicationContext.xml")
public class testArticle {
   Logger logger=Logger.getLogger(testArticle.class);
    @Autowired
    TArticleService tArticleService;
    @Autowired
    TArticleCommentsService tArticleComments;

   @Test
    public void  getAllArticle(){
        List<TArticle>list=tArticleService.queryAllTArticle();
        for (TArticle tArticle : list) {
            logger.debug(list);
        }
    }
    @Test
    public void test(){
        List<TArticleComments> allComments = tArticleComments.getAllComments();
        for (TArticleComments allComment : allComments) {
            logger.debug(allComment);
        }
    }
    @Test
    public void test2(){
        List<TArticleComments> article = tArticleComments.findArticle();
        for (TArticleComments articleComments : article) {
            System.out.println(articleComments);
        }
    }
}
